<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>globalAlpha 填充绘色</title>
    <link rel="stylesheet" type="text/css" href="/css/YTSConfig.css">
    <link rel="stylesheet" type="text/css" href="/css/Style.css">
</head>
<body>
    <div class="body SuspensionFixationALLWindow">
        <canvas id="tutorial" class="canvas AbsHorizontalVerticalCenter"
            style="width: 300px; height: 150px;">
            <p>不支持类型内容, 这是一个 HTML Canvas 控件</p>
        </canvas>
    </div>

    <script type="text/javascript">
        var canvas = document.getElementById('tutorial');
        if (!canvas.getContext) {
            alert('不支持 canvas.getContext 意味: 不支持 canvas 属性');
        }
        var ctx = canvas.getContext('2d');

        // 绘制 四色 背景
        ctx.fillStyle = '#FD0';
        ctx.fillRect(0, 0, 75, 75);

        ctx.fillStyle = '#6C0';
        ctx.fillRect(75, 0, 75, 75);

        ctx.fillStyle = '#09F';
        ctx.fillRect(0, 75, 75, 75);

        ctx.fillStyle = '#F30';
        ctx.fillRect(75, 75, 75, 75);

        ctx.fillStyle = '#FFF';
        // 设置透明度值
        ctx.globalAlpha = 0.2;

        // 画半透明圆
        for (var i = 0; i < 7; i++) {
            ctx.beginPath();
            ctx.arc(75, 75, 10+10*i, 0, Math.PI*2, true);
            ctx.fill();
        }

    </script>
</body>
</html>
